<!--{include(file='head.html')}-->
<div id="wrap">
	<!--{include('left.html')}-->
	<div id="maincont">
		<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
		<div id="main_c" >
			<form name="seaform" id="seaform" action="<!--{url('admin','userqa','index')}-->" method="post" onsubmit="$.oper.checkq('submit')">
			<div class="bt_bk">
				<span class="btn">
					<a href="javascript:void(0);" onclick="$.oper.refresh();return false;">刷新</a>
					<a href="javascript:void(0);" onclick="$.oper.remove();return false;">移除</a>
				</span>
				<span class="search_bk">
					<select name="qtype" class="select_tx">
						<option value="item"	<!--{if $qtype == 'item'}-->selected<!--{/if}-->	>商品</option>
						<option value="user"	<!--{if $qtype == 'user'}-->selected<!--{/if}-->	>用户</option>
						<option value="content"	<!--{if $qtype == 'content'}-->selected<!--{/if}--> >内容</option>
					</select>
					<input type="text" class="input_tx <!--{if !$q}-->hintinput<!--{/if}-->" name="q" id="q" 
						value="<!--{def($q,'商品（ID）/用户（ID）/内容')}-->" onfocus="$.oper.checkq('focus')" onblur="$.oper.checkq('blur')"/>
					<input type="button" value="搜索" class="input_bt" onclick="$.oper.seasubmit()"/>
				</span>
				<span class="state_tip"></span>
			</div>
			<input type="hidden" value="<!--{def($pagearr['page'],1)}-->"		name="page" id="page"/>
			<input type="hidden" value="<!--{def($pagearr['pagesize'],10)}-->"	name="pagesize" id="pagesize" />
			</form>
			<!--{include_page("page.html","top")}-->
			<table class="tableStyle" border="0" cellspacing="0" cellpadding="0">
				<thead>
					<tr align="center">
						<th width="5%"><input type="checkbox" value="1" name="allselect" id="allselect" autocomplete="off" onclick="$.oper.selectall()"/></th>
						<th width="10%">操作</th>
						<th width="10%">用户</th>
						<th width="25%" colspan="2">商品</th>
						<th style="width:200px;">咨询内容</th>
						<th style="width:200px;">管理员回复</th>
					</tr>
				</thead>
				<tbody id="listtbody">
					<!--{foreach $qalist qa}-->
					<tr align="center" id="tr_<!--{$qa.qaid}-->">
						<td><input type="checkbox" value="<!--{$qa.qaid}-->" name="singleselect" autocomplete="off"/></td>
						<td>
							<a href="javascript:void(0);" class="reply"  onclick="$.oper.reply('<!--{$qa.qaid}-->');return false;"></a>
							<a href="javascript:void(0);" class="remove" onclick="$.oper.remove('<!--{$qa.qaid}-->');return false;"></a>
						</td>
						<td align="left">
							<!--{$qa.uid}-->/<!--{$qa.uname}-->
							<br />
							ip:<!--{$qa.ip}-->
							<br />
							时间:<!--{date("m月d日",$qa.addtime)}-->
						</td>
						<td align="left" width="5%">
							<a href="<!--{url('index','item','index','itemid=$qa[itemid]')}-->" target="_blank">
								<img src = "<!--{$qa.itemimg}-->_50x50.jpg" width="50" height="50" onerror="this.onerror='',this.src='images/nopicture.jpg'"/>
							</a>
						</td>
						<td align="left" width="20%">
							<a href="<!--{url('index','item','index','itemid=$qa[itemid]')}-->" target="_blank"><!--{$qa.itemname}--></a>
						</td>
						<td align="left"><!--{$qa.content}--></td>
						<td align="left" class="replytd">
						<!--{if $qa.replytime}-->
							时间:<!--{date("m月d日",$qa.replytime)}-->
							<br />
							内容：<!--{$qa.replycontent}-->
						<!--{else}-->
							--
						<!--{/if}-->
						</td>
					</tr>
					<!--{/foreach}-->
				</tbody>
			</table>
			<!--{include_page("page.html","foot")}-->
		</div>
		<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
	</div>
</div>
<!--{include(file='foot.html')}-->
<script type="text/javascript">
$(function(){
	$.oper.init("<!--{url('admin','userqa','userqasave')}-->").setdefq('商品（ID）/用户（ID）/内容');
	$.oper.reply = function(qaid){
		jPrompt("","回复",function(val) {
			if(!val) {
				jAlert("请输入回复内容！");
				return false;
			}
			var postdata = {reply:val,qaid:qaid,opertype:'editfield',field:'reply'}
			$.post($.oper.url,postdata,function(data) {
				var jsObject = eval('(' + data + ")");
				if(jsObject.ret == "success") {
					$("#tr_"+qaid).find(".replytd").html("时间：刚刚<br />内容：" + jsObject.replycontent);
				} else {
					jAlert("发生错误,请刷新页面后重新执行该操作","警告");
				}
			})
		})
	}
});
</script>